<?php

namespace App\Admin\Actions\Keyword;

use App\Miya\Models\Area;
use App\Miya\Models\DerivativeKeyword;
use App\Miya\Models\Keyword;
use Encore\Admin\Actions\Action;
use Illuminate\Http\Request;

class ClearDerivative extends Action
{
    protected $selector = '.clear-derivative';

    public function handle(Request $request)
    {
        DerivativeKeyword::truncate();

        return $this->response()->success('删除全部衍生词成功!')->refresh();
    }

    public function dialog()
    {
        $this->confirm('确定批量生成衍生词吗?');
    }

    public function html()
    {
        return <<<HTML
        <a class="btn btn-sm btn-danger clear-derivative">清空衍生关键词</a>
HTML;
    }
}
